package com.panfeng.xcloud.boss.provider.assets.config;

import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class RestTemplateClientConfig {

    @Bean
    RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
        return restTemplateBuilder
                .setConnectTimeout(5000) //单位ms, 设置连接时间，避免线程过多被阻塞挂起，导致整个系统宕机
                .setReadTimeout(5000)
                .build();
    }

}
